<template>
	<div>
		<h1>
			添加类型
		</h1>
		<el-form label-width="80px">
			<el-form-item label="级别:">
				<el-input v-model="pid"></el-input>
			</el-form-item>
			<el-form-item label="名称:">
				<el-input v-model="name"></el-input>
			</el-form-item>
			<el-form-item label="顺序:">
				<el-input v-model="prio"></el-input>
			</el-form-item>

		</el-form>
		<el-button style="margin-left: 27%;" @click="add()">添加</el-button>
	</div>

</template>

<script>
	export default {
		name: 'addtwo',
		data() {
			return {
				book: {},
				oo: {},
				pid: 0,
				name: '',
				prio: 0
			}
		},
		methods: {
			add() {
				this.book.id = 0;
				console.log("二级节点:" + this.pid);
				this.book.pid = this.pid;
				this.book.name = this.name;
				this.book.prio = this.prio;
				console.log(this.book.pid);
				console.log(this.book.name);
				console.log(this.book.prio);
				this.$postkv("/api/adm/type/add", this.book).then((resp) => {
					console.log(resp.data.msg);
				})
			}
		},
		mounted() {

			console.log(this.$route.query.dx);
			this.oo = this.$route.query.dx;
			this.pid = this.oo.id;
			console.log(this.book);
		}
	}
</script>

<style>
</style>